package com.gist.cithub.service;

import com.alibaba.fastjson.JSONArray;
import com.gist.cithub.service.utils.HttpRequestor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

@SpringBootApplication
@EnableDiscoveryClient//这个注解在Nacos中开启服务注册与发现功能
@EnableFeignClients(basePackages = "com.gist.cithub.service.feign")
public class CithubServiceApplication {
    @Value("${conductorAddress}")
    public static void main(String[] args) {
    JSONArray jsonArray=JSONArray.parseArray("[\n" +
            "  {\n" +
            "    \"ownerApp\": \"string\",\n" +
            "    \"createTime\": 0,\n" +
            "    \"updateTime\": 0,\n" +
            "    \"createdBy\": \"string\",\n" +
            "    \"updatedBy\": \"string\",\n" +
            "    \"name\": \"login\",\n" +
            "    \"description\": \"string\",\n" +
            "    \"retryCount\": 0,\n" +
            "    \"timeoutSeconds\": 0,\n" +
            "    \"inputKeys\": [\n" +
            "      \"string\"\n" +
            "    ],\n" +
            "    \"outputKeys\": [\n" +
            "      \"string\"\n" +
            "    ],\n" +
            "    \"timeoutPolicy\": \"RETRY\",\n" +
            "    \"retryLogic\": \"FIXED\",\n" +
            "    \"retryDelaySeconds\": 0,\n" +
            "    \"responseTimeoutSeconds\": 200,\n" +
            "    \"concurrentExecLimit\": 0,\n" +
            "    \"inputTemplate\": {},\n" +
            "    \"rateLimitPerFrequency\": 0,\n" +
            "    \"rateLimitFrequencyInSeconds\": 0\n" +
            "  }\n" +
            "]");
    HttpRequestor httpRequestor=new HttpRequestor();

        String res= null;
        try {
         res = httpRequestor.doRequest("POST","http://210.28.135.32:8080/api/metadata/taskdefs",new StringBuffer(jsonArray.toJSONString()));
//         res = httpRequestor.doRequest("POST","http://127.0.0.1:8080/api/metadata/taskdefs",new StringBuffer(jsonArray.toJSONString()));
//            res = httpRequestor.doRequest("POST","http://localhost:8080/api/metadata/taskdefs",new StringBuffer(jsonArray.toJSONString()));
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        System.out.println(res);
        SpringApplication.run(CithubServiceApplication.class, args);
    }


}
